package com.ai.entity.alarm;

import com.ai.entity.BasePage;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 页面分页查询入参
 */
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RecordAlarmPage extends BasePage<RecordAlarmPO> {

    private String cameraNickname;

    private String stripNo; //钢卷号

    private String functionType;    //功能代码

    /**
     * 是否误报（1.正确，2.错误）
     */
    private Integer isError;

    /**
     * 是否违章（1.未违章，2.违章）
     */
    private Integer isState;

    /**
     * 事件状态
     */
    private Integer isValid;

    /**
     * isValid
     */
    private Integer cameraId;

    /**
     * 分产线区域
     */
    private Integer subgroup;


    @Override
    public QueryWrapper<RecordAlarmPO> getQuery(QueryWrapper<RecordAlarmPO> queryWrapper) {

        return super.getQuery(queryWrapper).like((!StringUtils.isEmpty(stripNo)), "strip_no", stripNo)
                .eq((isError != null && isError != 0), "is_error", isError)
                .eq(!StringUtils.isEmpty(functionType), "function_type", functionType)
                .eq((isState != null && isState != 0), "is_state", isState)
                .eq((isValid != null), "is_valid", isValid)
                .eq((cameraId != null && cameraId != 0), "camera_id", cameraId)
                .eq((subgroup != null && subgroup != 0), "subgroup", subgroup);
    }
}
